package l1j.server.server.datatables;

import java.sql.PreparedStatement;
import java.sql.Timestamp;
import java.util.logging.Level;
import java.util.logging.Logger;

import l1j.server.L1DatabaseFactory;
import l1j.server.server.utils.SQLUtil;

public class LogDropItemTable {
	private static Logger _log = Logger.getLogger(LogDropItemTable.class
			.getName());
	
	/*logenchant.storeLogEnchant(pc.getId(), pc.getName(),
					objectId, item.getName(),item.getEnchantLevel(), count, x, y, pc.getMapId());*/
	public void storeLogEnchant(int char_id, String char_name, int obj_id,
			String item_name, int enchantlvl, int count,
			int x, int y, int map_id) {
		java.sql.Connection con = null;
		PreparedStatement pstm = null;
		try {
			con = L1DatabaseFactory.getInstance().getConnection();
			pstm = con
					.prepareStatement("INSERT INTO log_dropitem SET char_id=?, char_name=?, obj_id=?, item_name=?, enchantlvl=?, count=?, x=?, y=?, map_id=?, timestamp=?");
			pstm.setInt(1, char_id);
			pstm.setString(2, char_name);
			pstm.setInt(3, obj_id);
			pstm.setString(4, item_name);
			pstm.setInt(5, enchantlvl);
			pstm.setInt(6, count);
			pstm.setInt(7, x);
			pstm.setInt(8, y);
			pstm.setInt(9, map_id);
			pstm.setTimestamp(10, new Timestamp(System.currentTimeMillis()));
			pstm.execute();

		} catch (Exception e) {
			_log.log(Level.SEVERE, e.getLocalizedMessage(), e);
		} finally {
			SQLUtil.close(pstm);
			SQLUtil.close(con);

		}
	}
}
